package jmu.edu.yjc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jmu.edu.yjc.domain.bo.MessageBo;
import jmu.edu.yjc.domain.entity.Message;
import jmu.edu.yjc.domain.vo.message.UnreadVo;
import jmu.edu.yjc.domain.vo.user.UserContactVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;


/**
 * 消息记录表(Message)表数据库访问层
 *
 * @author makejava
 * @since 2023-01-20 19:09:47
 */
public interface MessageMapper extends BaseMapper<Message> {

    Message getLassMessageById(@Param("fromUserId")Long fromUserId, @Param("toUserId") Long toUserId);
    List<MessageBo> getMessages(@Param("res") Integer res, @Param("tar")Integer tar, @Param("fromUserId")Long fromUserId, @Param("toUserId")Long toUserId);
    Integer getTotal(@Param("fromUserId")Long fromUserId,@Param("toUserId")Long toUserId);

    List<UserContactVo> getUnreadContractById(@Param("id") Long id);

    @MapKey("contractId")
    Map<Long,UnreadVo> getUnreadList(Long id);
}

